<template>
	<view class="ys" :style="{background:topBg}">
		<view class="place" :style="{height:top+'px'}">

		</view>
		<view class="top" :style="{background:background}">
			<view class="back">
				<uni-icons type="left" size="20" v-if="showLeft"></uni-icons>
				<slot name="left"></slot>
			</view>
			<view class="title" :style="{color:color}">
				{{title}}
			</view>
			<view class="right">
				<slot name="right"></slot>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				top: ''
			}
		},
		props: {
			title: {
				type: String,
				default: ''
			},
			background: {
				type: String,
				default: 'transparent'
			},
			showLeft: {
				type: Boolean,
				default: true
			},
			topBg: {
				type: String,
				default: ''
			},
			color: {
				type: String,
				default: 'blace'
			}
		},
		created() {
			let info = uni.getWindowInfo()
			this.top = info.statusBarHeight
		},
		methods: {

		}
	}
</script>

<style lang="scss" scoped>
	.ys {
		position: sticky;
		top: 0;
		z-index: 1024;
	}

	.top {
		height: 44px;
		display: flex;
		align-items: center;
		padding: 0 10px;
		justify-content: space-between;
		box-sizing: border-box;
		width: 100%;


		.back {
			width: 80px;
			display: flex;
			align-items: center;

			text {
				font-size: 12px;
			}
		}

		.right {
			width: 80px;
			display: flex;
			align-items: center;
			justify-content: flex-end;
		}

		.title {
			font-weight: bold;
		}
	}
</style>